<?php
namespace Store\Model;
use Think\Model;

class OrderModel extends Model
{
    
    protected $_auto = array(
        array('create_time', NOW_TIME, self::MODEL_INSERT),
        array('update_time', NOW_TIME, self::MODEL_BOTH),
    );
    
    /**
     * @更改订单状态
     *
     * @param int $storeID
     * @param int $orderID
     * @param int $state 订单状态：0:已取消 1:未付款 2:已付款 3:已发货 4:已收货
     * @return bool
     */
    public function changeOrderState($storeID, $orderID, $state, $stateInfo)
    {
        $where = array( 'order_id' => $orderID, 'store_id' => $storeID );
        $data = array( 'order_state' => $state, 'state_info' => $stateInfo, 'update_time' => time() );
        return $this->where($where)->save($data);
    }
    
}
?>